home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / serverlib / include / openlog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  4.7 KB  |  137 lines

  1. /*
  2.  *   $RCSfile: openlog.h,v $  
  3.  *   $Revision: 1.1.1.1 $  
  4.  *   $Date: 1996/05/04 21:55:45 $      
  5.  */ 
  6. #ifndef __OPENLOG_H__
  7. #define __OPENLOG_H__
  8.  
  9. /**********************************************************************
  10. * EXODUS Database Toolkit Software
  11. * Copyright (c) 1991 Computer Sciences Department, University of
  12. *                    Wisconsin -- Madison
  13. * All Rights Reserved.
  14. *
  15. * Permission to use, copy, modify and distribute this software and its
  16. * documentation is hereby granted, provided that both the copyright
  17. * notice and this permission notice appear in all copies of the
  18. * software, derivative works or modified versions, and any portions
  19. * thereof, and that both notices appear in supporting documentation.
  20. *
  21. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  22. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  23. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  24. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  25. *
  26. * The EXODUS Project Group requests users of this software to return 
  27. * any improvements or extensions that they make to:
  28. *
  29. *   EXODUS Project Group 
  30. *     c/o David J. DeWitt and Michael J. Carey
  31. *   Computer Sciences Department
  32. *   University of Wisconsin -- Madison
  33. *   Madison, WI 53706
  34. *
  35. *     or exodus@cs.wisc.edu
  36. *
  37. * In addition, the EXODUS Project Group requests that users grant the 
  38. * Computer Sciences Department rights to redistribute these changes.
  39. **********************************************************************/
  40. /*
  41.  *    define the structure that holds the state of the open log
  42.  */
  43. typedef struct    {
  44.  
  45.     VOLID        volid;                /* volid that holds the log file        */
  46.     VOLREC        *volRec;            /* to avoid doing io_FindVolumeId()     */
  47.     SHORTPID    logFileAddr;        /* page address of first page in log    */
  48.     BUFGROUP    *writeGroup;        /* buffer group for log writes            */
  49.     BUFGROUP    *readGroup;            /* buffer group for log reads            */
  50.     int            readPages;            /* number of pages in read group        */
  51.     int            writePages;            /* number of pages in write group        */
  52.     PAGE2SIZE    page2size;            /* log 2 of log page size                */
  53.     int         pageSize;            /* page size of a log page                */
  54.     unsigned  int     pageMask;        /* mask of page size                    */
  55.     int            usableBytes;        /* usable bytes on the page                */
  56.     int            lastUsableByte;        /* last usable byte on the page            */
  57.     int            filePages;            /* number of pages in the log file        */
  58.     int            fileBytes;            /* number of bytes in the log file        */
  59.     int            blocksPerPage;        /* physical blocks per logical page        */
  60.     SHORTPID    tailPid;            /* pid of current tail of log file        */
  61.     LSNOFFSET    tailLSN;            /* byte offset of current end of log    */
  62.     PAGEHASH    *tailBuffer;        /* pointer to the current end of log    */
  63.     GROUPLINK    *tailLink;            /* link of the tail buffer of the log    */
  64.     LSN            nextValidLSN;        /* lsn of next log record header to place on a log page */
  65.     SHORTPID    activePid;            /* page of oldest active log record        */
  66.     FORCEMARK    activeUnique;        /* unique number of active                */
  67.     LSNOFFSET    activeLSN;            /* byte offset of oldest active record    */
  68.     LIST        activeList;            /* list of active log transactions        */
  69.     GROUPLINK    *controlBuffer;        /* pointer to the control buffer        */
  70.     SHORTPID    checkPointPid;        /* page that holds current checkpoint    */
  71.     LSN            checkPointLSN;        /* byte offset of current checkpoint    */
  72.     FORCEMARK    checkPointUnique;    /* unique number of checkpoint            */
  73.     LATCH        logLatch;            /* general log synchronization latch    */
  74.     SEMAPHORE    writeSemaphore;        /* semaphore for writing log            */
  75.     SEMAPHORE    readSemaphore;        /* semaphore for reading log            */
  76.     LIST        checkPointList;        /* trans waiting for checkpoint end        */
  77.     LIST        recoverList;        /* trans waiting for recovery end        */
  78.     LIST        closeList;          /* threads waiting for the close        */
  79.     int            wrapCount;            /* current wrap count of log            */
  80.     FORCEMARK    logRecordCount;        /* monotically increasing log rec count    */
  81.     int            checkPointCount;    /* records since last checkPoint        */
  82.     FORCEMARK    forceMark;            /* current force mark of log            */
  83.     int            checkPointInterval; /* number of log pages between checkpoints */
  84.     FLAGS        flags;
  85.     MAGIC        magic;
  86.     
  87. } OPENLOG;
  88.  
  89.  
  90. /*
  91.  *    define the open log magic number
  92.  */
  93. #define OPENLOG_MAGIC    0xd7af5db4
  94.  
  95.  
  96. #if MAGIC_CHECKING IS_ENABLED
  97.  
  98.  
  99. #define INIT_OPENLOG_MAGIC(_openLog)                \
  100.                                                     \
  101.     (_openLog)->magic = OPENLOG_MAGIC;
  102.     
  103.  
  104. #define CHECK_OPENLOG_MAGIC(_openLog)                \
  105.                                                     \
  106.     if ((_openLog)->magic != OPENLOG_MAGIC)    {        \
  107.         SM_ERROR(TYPE_FATAL, esmINTERNAL);            \
  108.     }
  109.  
  110.  
  111. #else
  112.  
  113.  
  114. #define INIT_OPENLOG_MAGIC(_openLog)
  115.  
  116. #define CHECK_OPENLOG_MAGIC(_openLog)
  117.  
  118.  
  119. #endif
  120.  
  121.  
  122. /*
  123.  *    define the flags of the open log structure
  124.  */
  125. #define LOG_CLOSE                    0x1
  126. #define LOG_CHECKPOINT_IN_PROGRESS    0x2
  127. #define LOG_DIRTYFORCE_IN_PROGRESS    0x4
  128.  
  129.  
  130. /*
  131.  *    define the phases of the log processing
  132.  */
  133. #define ANALYSIS_PHASE    1
  134. #define REDO_PHASE        2
  135.  
  136. #endif __OPENLOG_H__
  137.